package spec.ganlijuan.unit5;

import spec.ganlijuan.unit4.animal.Animal;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;

public class CollectionTest {
    public static void main(String[] orgs){
        Object o = new ArrayList();
        Collection c =new ArrayList();
        Animal a1=new Animal("","","");
        Animal a2=new Animal("","","");
        Animal a3=new Animal("","","");
        c.add(a1);
        System.out.println(c.size());
        System.out.println(c.isEmpty());

       ArrayList a=new ArrayList();
       a.size();
       c.size();
       a.listIterator();
        c.add(a2);
        System.out.println(c.size());
        System.out.println(c.isEmpty());
        c.add(a3);
        System.out.println(c.size());
        System.out.println(c.isEmpty());

        c.remove(a1);
        System.out.println("after add obiect;");
        System.out.println("c.size()="+c.size());

        boolean isEmpty=c.isEmpty();
        System.out.println("集合是否为空:"+isEmpty);

        boolean isContains=c.contains(a2);
        System.out.println("集合是否包含a2:"+isContains);

        c.clear();
        System.out.println("after clear");
        System.out.println("c.size()"+c.size());
    }
}

